<?php
/**
 * Created by PhpStorm.
 * User: wangjun
 * Date: 2016-10-26
 * Time: 13:55
 */

namespace Home\Model;
use Think\Model;

class PersonnelModel extends Model{

    public function seach(){
        $requester = I('get.requester');
        if($requester){
            $where['requester'] = array('like',"%".$requester."%");
        }
        $client = I('get.client');
        if($client){
            $where['client'] = array('like',"%".$client."%");
        }
        $coun = $this->where($where)->count();
        $page = new \Think\Page($coun,20);
        $page->setConfig('prev','上一页');
        $page->setConfig('next','下一页');
        $list = $this->where($where)->limit($page->firstRow,$page->listRows)->select();
        return array(
            'list' => $list,
            'page_str' => $page->show(),
            'first' => $page->firstRow
        );
    }

}